<template>
  <div class="yingmoo-store">
    <ul class="nav">
      <router-link tag="li" to="/ymMemberaccount">账户信息</router-link>
      <router-link tag="li" to="/ymMemberaccountamendtel">修改手机号</router-link>
      <router-link tag="li" to="/ymMemberaccountamendneweimal">修改邮箱</router-link>
      <router-link tag="li" to="/ymMemberaccountamendpassword">修改密码</router-link>
      <router-link tag="li" v-if="user.shop == 0" to="/ymMemberapplyforverify">申请验证</router-link>
    </ul>
    <div class="error">
      <div class="content">
        <h4>鹰目网媒体主入驻流程</h4>
        <div class="succeed">
          <el-steps :space="200" :active="0" finish-status="success">
            <el-step title="填写基本信息"></el-step>
            <el-step title="提交企业资质"></el-step>
            <el-step title="提交审核"></el-step>
          </el-steps>
          <p class="bule">填写开通店铺所需信息，等待鹰目网工作人员审核（期间不能修改提交信息），若资料不正确或不完整，客服会打回提交信息，需修改信息后重新提交</p>
          <p>是否发布
          	<span><label><input type="radio" name="publish" v-model="ymmembercorp.publish" value="1" />是</label></span>
          	<span><label><input type="radio" name="publish" v-model="ymmembercorp.publish" value="0" />否</label></span></p>
          <!--<div class="test">
            <p>了解鹰监测服务详情，<span class="btn btn1">点击此处</span></p>
            <p>加入鹰监测，即可享受以下服务</p>
            <p>1、给您的客户免费提供跨区域户外广告监测服务</p>
            <p>2、优先使用、推荐您的媒体资源</p>
            <p>提供定制版高级店铺，授予终身免费使用权</p>
            <p>加入鹰监测，默认您已阅读并同意 <span class="btn btn2">《鹰目全球户外广告监测服务体系合作协议》</span></p>
          </div>-->
        </div>
        <h4>填写企业信息</h4>
        <div class="message">
          <div class="message-left">
            <p>企业名称</p>
            <p>所在地区</p>
            <p>详细地址</p>
            <p>主营业务</p>
            <p>一句话简介</p>
            <p>手机号码</p>
            <p>公司电话</p>
          </div>
          <div class="message-right">
            <div class="input">
              <input v-model="ymmembercorp.contentCorp" type="text" placeholder="" /><span>*</span>
            </div>
            <div>
              <select v-model="procode" name="" id="proCode" @change="showProCode">
	            	<option value="">--请选择--</option>
	              <option v-for="pro in province" :value="pro.value">{{pro.text}}</option>
	            </select>
	            <select v-model="citycode" name="" id="cityCode" @change="showCityCode">
	              <option value="">--请选择--</option>
	              <option v-for="city in citys" :value="city.value">{{city.text}}</option>
	            </select>
	            <select v-model="ymmembercorp.contentArea" name="" id="area" @change="confirmSelect">
	              <option value="">--请选择--</option>
	              <option v-for="area in areas" :value="area.value">{{area.text}}</option>
	            </select><span>*</span>
            </div>
            <div class="input">
              <input v-model="ymmembercorp.contentAddr" type="text" placeholder="" /><span>*</span>
            </div>
            <div class="one">
              <!--<select name="" class="sel">
                <option value="" selected="selected">请选择主营业务（可多选）</option>
              </select><span>*</span>-->
              <input type="text" v-model="ymmembercorp.contentBusiness" placeholder="主营业务" /><span>*</span>
            </div>
            <div class="input">
              <input v-model="ymmembercorp.contentSlo" type="text" placeholder="" /><span>*</span>
            </div>
            <p>{{user.mobile}} <span><img src="../assets/ym-member/count/dui.png" />已验证</span><span><img src="../assets/ym-member/count/tan.png" />修改手机号</span></p>
            <div class="input">
              <input v-model="ymmembercorp.contentTel" type="text" placeholder="" /><span>*</span>
            </div>
            <div class="input">
            	<input type="button" class="submit" @click="commit" value="提交"/>
            </div>
            <!--<router-link tag="div" to="/ymMemberapplyforverifysubmit" class="submit">提交</router-link>-->
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "yingmoo-store",
    data(){
    	return{
    		requestAddr:this.GLOBAL.addr,
    		user:{},
    		ymmembercorp:{},
    		province:{},
    		citys:{},
    		areas:{},
    		procode:null,
    		citycode:null,
    	}
    },
    mounted(){
    	this.getUser();
    	this.getAreaList('');
    	this.getMemberCorpInfo();
    },
    methods:{
    	getUser:function(){
				var data = localStorage.getItem("user");
				this.user = JSON.parse(localStorage.getItem("user"));
			},
			getMemberCorpInfo:function(){
			this.$http.post(this.requestAddr+"/GetJson/getMemberCorpInfo",{"memberId":this.user.autoId},{emulateJSON:true}).then(
				(res)=>{
					console.log(res.data.memberCorp);
					this.ymmembercorp = res.data.memberCorp;
					var code = this.ymmembercorp.contentArea;
					this.procode = code.substring(0,4);
					this.getAreaList(this.procode);
					this.citycode = code.substring(0,8);
					this.getAreaList(this.citycode);
				}
			);
		},
			getAreaList:function(areaCode){
				this.$http.post(this.requestAddr+"/GetJson/getAreaList",{"parentCode":areaCode},{emulateJSON: true}).then(
					(res)=>{
						if(areaCode == null || areaCode == ''){
							this.province = res.data.result;						
						}else if(areaCode != null && areaCode.length == 4){
							this.citys = res.data.result;
						}else{
							this.areas = res.data.result;
						}
					}
				);
			},
			showProCode:function(){
				var mySelected = document.getElementById("proCode");
				var val = mySelected.value;
				this.citys = null;
				this.areas = null;
				this.getAreaList(val);
				this.showCityCode();
			},
			showCityCode:function(){
				var selected = document.getElementById("cityCode").value;
				if(selected != null && selected != ''){
					this.getAreaList(selected);				
				}else{
					this.areas = null;
				}
			},
			confirmSelect:function(){
				this.ymmembercorp.contentArea = document.getElementById("area").value;
				/*console.log(this.ymmembercorp.contentArea);*/
			},
			commit:function(){
				console.log(this.ymmembercorp);
				this.$http.post(this.requestAddr+"/GetJson/modifyMemberCorp",this.ymmembercorp,{emulateJSON:true}).then(
					(res)=>{
						if(res.data.code == 0){
							console.log(res.data);
							window.location.href = "../ymMemberapplyforverifysubmitover#/ymMemberapplyforverifysubmit";
						}
					}
				)
			}
    }
  }

</script>
<style scoped>
  .el-steps {
    width: 500px;
    padding-top: 35px;
  }

</style>
<style scoped lang="less">
  .yingmoo-store {
    width: 100%;
    .nav {
      width: 1200px;
      height: 46px;
      margin: 0 auto;
      display: flex;
      align-items: center;
      background-color: #f2f2f2;
      margin-top: 20px;
      li {
        list-style: none;
        width: 90px;
        height: 30px;
        margin: 0 20px;
        line-height: 30px;
        color: #666666;
        text-align: center;
        font-size: 16px;
        cursor: pointer;
        &:nth-child(5) {
          background-color: #036eb7;
          color: white;
        }
        &:hover {
          background-color: #036eb7;
          color: white;
        }
      }
    }
    .error {
      width: 1200px;
      background-color: white;
      margin: 0 auto;
      .content {
        width: 1200px;
        background-color: white;
        margin: 0 auto;
        margin-bottom: 30px;
        h4 {
          font-size: 16px;
          color: #333333;
          font-weight: bold;
          padding-left: 40px;
          padding-top: 40px;
        }
        .succeed {
          width: 1030px;
          margin: 0 auto;
          p {
            padding-top: 35px;
            font-size: 14px;
            color: #333333;
            font-weight: bold;
            span {
              padding-left: 30px;
            }
          }
          .bule {
            color: #036eb7;
          }
          .test {
            width: 1030px;
            height: 250px;
            background-color: #f3f3f4;
            margin-top: 35px;
            p {
              padding-top: 0;
              line-height: 30px;
              padding-left: 25px;
              &:nth-child(1) {
                padding-top: 20px;
                padding-bottom: 15px;
              }
              &:last-child {
                padding-top: 15px;
              }
              span {
                color: #f29600;
                text-decoration: underline;
                padding-left: 0;
              }
            }
          }
        }
        .message {
          display: flex;
          .message-left {
            p {
              width: 145px;
              text-align: right;
              line-height: 60px;
              font-size: 12px;
              color: #333333;
              &:nth-child(1) {
                margin-top: 20px;
              }
            }
          }
          .message-right {
            margin-left: 25px;
            .name {
              margin-top: 30px;
              line-height: 37px;
            }
            p {
              line-height: 23px;
              color: #999999;
              font-size: 14px;
              margin-top: 36px;
              margin-bottom: 32px;
              span {
                margin-left: 10px;
                img {
                  margin-right: 3px;
                }
              }
            }
            .one {
              .sel {
                width: 634px;
                margin-right: 0;
                color: #999999;
                padding-left: 10px;
              }
            }
            div {
              margin-top: 25px;
              .input {
                width: 625px;
              }
              input {
                width: 625px;
                height: 31px;
                padding-left: 10px;
                font-size: 14px;
                outline: none;
                border-radius: 3px;
                border: 1px solid #dddddd;
              }
              span {
                margin-left: 10px;
                color: #f29600;
              }
              select {
                width: 198px;
                height: 37px;
                margin-right: 16px;
                outline: none;
                border-radius: 3px;
                border: 1px solid #dddddd;
                color: #999999;
                &:nth-child(3) {
                  margin-right: 1px;
                }
              }
              .img {
                img {
                  position: relative;
                  top: 10px;
                  left: 15px;
                }
              }
              .color {
                color: #f29600;
                font-size: 14px;
                padding-left: 15px;
              }
              .cm {
                padding-left: 30px;
              }
            }
            .submit {
              width: 103px;
              height: 30px;
              color: white;
              background-color: #f29600;
              text-align: center;
              line-height: 30px;
              border-radius: 7px;
              margin-top: 44px;
              margin-bottom: 35px;
            }
          }
        }
      }
    }
  }

</style>
